C# is a modern, object-oriented programming language developed by Microsoft. It runs on the .NET Framework and is used to develop applications ranging from web to desktop and mobile applications.
The fundamental principles of OOP are Encapsulation, Inheritance, Polymorphism, and Abstraction.
A class is a blueprint or template for creating objects. An object is an instance of a class..
Inheritance is a feature of OOP where a new class (derived class) inherits properties and behavior (methods) from an existing class (base class)
Answer: Polymorphism allows methods to do different things based on the object it is acting upon. It can be achieved through function overloading, operator overloading, and method overriding (via virtual functions).
An interface defines a contract that implementing classes must adhere to. It contains definitions for a group of related functionalities that a class or struct can implement..
An abstract class can have implementations for some of its members, but an interface cannot. A class can implement multiple interfaces but can inherit only one abstract class.
Encapsulation is the bundling of data with the methods that operate on that data. It restricts direct access to some of an object's components and can prevent the accidental modification of data. .
A delegate is a type-safe function pointer. It allows methods to be passed as parameters and can be used to define callback methods.
n event is a message sent by an object to signal the occurrence of an action. Events are typically used in conjunction with delegates.
Both ref and out are used to pass arguments by reference. ref requires that the variable be initialized before it is passed, while out does not require initialization before being passed but must be assigned a value before the method returns.
LINQ (Language Integrated Query) is a set of features in C# that provides query capabilities directly in the C# language, allowing you to write queries for databases, collections, XML, and more in a consistent manner.
Nullable types allow value types (such as int, float, etc.) to represent all the values of their underlying type plus an additional null value.
String is immutable, meaning any operation that appears to modify it actually creates a new string. StringBuilder is mutable, meaning it can be modified without creating a new object, which is more efficient for frequent or large string manipulations.
The access specifiers in C++ are public, private, and protected. They define the access level of class members.
.
Garbage collection is an automatic memory management feature in .NET that reclaims memory occupied by objects that are no longer in use.
async and await are used to write asynchronous code more easily. async marks a method as asynchronous, and await is used to wait for an asynchronous operation to complete without blocking the main thread.
Extension methods allow you to add new methods to existing types without modifying the original type. They are defined as static methods but are called as if they were instance methods on the extended type .
A lambda expression is a concise way to represent an anonymous function. It uses the => syntax and can be used to create delegates or expression tree types.